﻿<common:LayoutAwarePage xmlns:UI="using:Microsoft.Advertising.WinRT.UI" 
    x:Name="pageRoot"
    x:Class="StudyTime_1.editSelected"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:StudyTime_1"
    xmlns:common="using:StudyTime_1.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" Loaded="pageRoot_Loaded" >

    <Page.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Name="mainGrid"  Style="{StaticResource LayoutRootStyle}" >
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}">
            	<Run Text="Edit Selected"/>
            	<LineBreak/>
            	<Run/>
            </TextBlock>
        </Grid>
        <Grid Visibility="Collapsed" Name="cardEditContainer" HorizontalAlignment="Center"  Margin="18,15,25,37" VerticalAlignment="Center" Background="#FF1B58B8" Width="1237" Height="608" Grid.Row="1">
            <TextBox x:Name="question" HorizontalAlignment="Left" Height="52" Margin="299,176,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="644" IsSpellCheckEnabled="True" FontSize="18"/>
            <TextBlock HorizontalAlignment="Left" Margin="153,176,0,0" TextWrapping="Wrap" Text="Question or Vocab Item" VerticalAlignment="Top" Height="52" Width="140"/>
            <TextBox x:Name="answer" HorizontalAlignment="Left" Height="301" Margin="299,279,0,0"  VerticalAlignment="Top" Width="644" AcceptsReturn="True" ManipulationMode="System" FontSize="16" TextWrapping="Wrap" IsSpellCheckEnabled="True"/>
            <TextBlock  HorizontalAlignment="Left" Margin="153,279,0,0" TextWrapping="Wrap" Text="Answer or Definition" VerticalAlignment="Top" Height="52" Width="140"/>
            <TextBlock HorizontalAlignment="Left" Height="57" Margin="299,103,0,0" TextWrapping="Wrap" Text="Edit Study Card" VerticalAlignment="Top" Width="644" TextAlignment="Center" FontFamily="Segoe UI" FontSize="20"/>
            <TextBlock x:Name="errorBox" HorizontalAlignment="Center" Height="77" Margin="15,88,880,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="342" FontSize="18" Foreground="#FFF70808"/>
            <Button x:Name="saveEdit" Content="Save Edit" HorizontalAlignment="Left" Height="75" Margin="35.5,434,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="addCard_Click" >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="-20"/>
                </Button.RenderTransform>

            </Button>
            
            <Button x:Name="addImage" Content="Add Image" HorizontalAlignment="Left" Height="75" Margin="966,377,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="addImage_Click"  >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="20"/>
                </Button.RenderTransform>
            </Button>

            <Button x:Name="nextItem" Content="Next" HorizontalAlignment="Left" Height="75" Margin="966,465.5,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="nextItem_Click"  >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="20"/>
                </Button.RenderTransform>
            </Button>


            <Image x:Name="insertPreview" HorizontalAlignment="Left" Height="192" Margin="964,109,0,0" VerticalAlignment="Top" Width="242"/>
            <TextBlock HorizontalAlignment="Center" Height="18" Margin="1029,94,0,0" TextWrapping="Wrap" Text="Image Preview" VerticalAlignment="Top" Width="106" TextAlignment="Center"/>
            <TextBlock HorizontalAlignment="Center" x:Name="cardCount" TextAlignment="Center" Height="25.031" Margin="235.5,412.506,991.833,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="25.667" RenderTransformOrigin="0.621,0.737" UseLayoutRounding="False" d:LayoutRounding="Auto" FontSize="16">
                <TextBlock.RenderTransform>
                    <CompositeTransform SkewY="-20"/>
                </TextBlock.RenderTransform>
            </TextBlock>
        </Grid>
        <Grid Visibility="Collapsed" Name="quizEditContainer" HorizontalAlignment="Center"  Margin="15,11,24,0" Grid.Row="1" VerticalAlignment="Center" Background="#FF128425" Width="1241"  >
            <TextBlock HorizontalAlignment="Left" Height="43" Margin="272,530,0,0" TextWrapping="Wrap" Text="Final Answer" VerticalAlignment="Top" Width="164" TextAlignment="Center" FontSize="16" Grid.Row="1"/>
            <TextBlock HorizontalAlignment="Left" Height="38" Margin="339,25,0,0" TextWrapping="Wrap" Text="Edit Multiple Choice Quesions" VerticalAlignment="Top" Width="621" TextAlignment="Center" FontFamily="Segoe UI" FontSize="20"/>
            <TextBox x:Name ="multQuest" HorizontalAlignment="Left" Height="79" Margin="439,100,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="518" FontSize="14" IsSpellCheckEnabled="True"/>
            <TextBlock HorizontalAlignment="Left" Height="43" Margin="272,100,0,0" TextWrapping="Wrap" Text="Question" VerticalAlignment="Top" Width="164" TextAlignment="Center" FontSize="16" Grid.Row="1"/>
            <TextBox x:Name="answerA" HorizontalAlignment="Left" Height="78" Margin="439,185,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="518" IsSpellCheckEnabled="True"/>
            <TextBlock HorizontalAlignment="Left" Height="43" Margin="272,185,0,0" TextWrapping="Wrap" Text="Answer A" VerticalAlignment="Top" Width="164" TextAlignment="Center" FontSize="16" Grid.Row="1"/>
            <TextBox x:Name="answerB" HorizontalAlignment="Left" Height="79" Margin="439,269,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="518" IsSpellCheckEnabled="True"/>
            <TextBlock HorizontalAlignment="Left" Height="43" Margin="272,269,0,0" TextWrapping="Wrap" Text="Answer B" VerticalAlignment="Top" Width="164" TextAlignment="Center" FontSize="16" Grid.Row="1"/>
            <TextBox x:Name="answerC" HorizontalAlignment="Left" Height="84" Margin="439,354,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="518" IsSpellCheckEnabled="True"/>
            <TextBlock HorizontalAlignment="Left" Height="42" Margin="272,354,0,0" TextWrapping="Wrap" Text="Answer C" VerticalAlignment="Top" Width="164" TextAlignment="Center" FontSize="16" Grid.Row="1"/>
            <TextBox x:Name="answerD" HorizontalAlignment="Left" Height="80" Margin="439,444,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="518" IsSpellCheckEnabled="True"/>
            <TextBlock HorizontalAlignment="Left" Height="43" Margin="272,444,0,0" TextWrapping="Wrap" Text="Answer D" VerticalAlignment="Top" Width="164" TextAlignment="Center" FontSize="16" Grid.Row="1"/>
            <!--<TextBox x:Name="finalAnswer" HorizontalAlignment="Left" Height="43" Margin="439,530,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="81" IsSpellCheckEnabled="True"/>-->
            <ComboBox  Name="qAnswer" HorizontalAlignment="Left" Height="43" Margin="439,530,0,0" VerticalAlignment="Top" Width="127" FontSize="18"/>
            <Button  x:Name="setNewQuestion" Content="Save Edit" HorizontalAlignment="Left" Height="87" Margin="30,335,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5"  UseLayoutRounding="False" d:LayoutRounding="Auto" Click="setNewQuestion_Click">
                <Button.RenderTransform>
                    <CompositeTransform SkewY="-20"/>
                </Button.RenderTransform>
            </Button>
            <TextBlock x:Name="qError" HorizontalAlignment="Left" Height="77" Margin="969,-103,-23,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="324" FontSize="18" Foreground="#FFF70808"/>
            <Button x:Name="lstQuestion" IsEnabled="False" Content="Last Question" HorizontalAlignment="Left" Height="87" Margin="30,439,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="lstQuestion_Click" >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="-20"/>
                </Button.RenderTransform>
            </Button>
            <Button  x:Name="qaddImage" Content="Add Image" HorizontalAlignment="Left" Height="87" Margin="1002,335,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5"  UseLayoutRounding="False" d:LayoutRounding="Auto" Click="qaddImage_Click" >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="20"/>
                </Button.RenderTransform>
            </Button>
            <Button  x:Name="nextQuestion" IsEnabled="False" Content="Next Question" HorizontalAlignment="Left" Height="87" Margin="1002,439,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5"  UseLayoutRounding="False" d:LayoutRounding="Auto" Click="nextQuestion_Click"  >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="20"/>
                </Button.RenderTransform>
            </Button>
            <Image Name="qPreview" HorizontalAlignment="Left" Height="192" Margin="975,33,0,0" VerticalAlignment="Top" Width="242"/>
            <TextBlock HorizontalAlignment="Left" Height="18" Margin="1040,18,0,0" TextWrapping="Wrap" Text="Image Preview" VerticalAlignment="Top" Width="106" TextAlignment="Center"/>
            <!--<TextBlock HorizontalAlignment="Left" x:Name="questCounter" Padding="5" Height="29" Margin="222,315,0,0" TextWrapping="Wrap" Text="0"  TextAlignment="Center" VerticalAlignment="Top" Width="34" RenderTransformOrigin="0.5,0.5" FontFamily="Segoe WP Semibold" FontSize="18">
                <TextBlock.RenderTransform>
                    <CompositeTransform SkewY="-20"/>
                </TextBlock.RenderTransform>
            </TextBlock>-->
            <StackPanel Name="lastQuestStack" Visibility="Collapsed" HorizontalAlignment="Center" Height="576" Margin="116,15,136,0" VerticalAlignment="Top" Width="1018" Background="#FF8D8B8B">
                <Button x:Name="stackBack"  Style="{StaticResource BackButtonStyle}"  Margin="36,0,0,36"   />
                <ScrollViewer>
                    <TextBlock x:Name="lastQuestTxt" HorizontalAlignment="Center" Height="826" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="1018" FontSize="28" FontFamily="Segoe Print"/>
                </ScrollViewer>
            </StackPanel>

        
        </Grid>
        <UI:AdControl HorizontalAlignment="Center" Height="90" Margin="476,36,76,0" VerticalAlignment="Top" Width="728" BorderBrush="White" ApplicationId="1616c4fe-e431-49f8-9c4d-403fbf13f9e1" AdUnitId="116616"/>
            <Button x:Name="rmvAd" Content="X"  HorizontalAlignment="Center" Height="52" Margin="1216,26,13,0" VerticalAlignment="Top" Width="51" FontSize="25" FontFamily="Segoe WP Semibold" Click="rmvAd_Click" />


        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
